const webpack = require('webpack')
const { merge } = require('webpack-merge')
const commonWebpackConfig = require('./webpack.common')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
module.exports = merge(commonWebpackConfig, {
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'js/[name][hash:8].js',
    chunkFilename: 'js/[name][hash:8].chunk.js',
    publicPath: '/'
  },
  devServer: {
    contentBase: path.resolve(__dirname, 'dist'),
    port: 3000,
    open: true,
    inline: true,
    hot: true,
    hotOnly: false,
    quiet: true,
    watchContentBase: true,
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new HtmlWebpackPlugin({
      title: 'vue',
      inject: true,
      template: path.resolve(__dirname, 'public/index.html'),
      templateParameters: {
        BASE_URL: './/'
      },
    })
  ],
  devtool: 'cheap-source-map'
})
